home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 2000 July / CD 3 / redhat-6.2.iso / RedHat / instimage / usr / lib / anaconda / iw / format.py < prev    next >
Encoding:
Python Source  |  2000-03-08  |  1.7 KB  |  55 lines

  1. from gtk import *
  2. from iw import *
  3. from thread import *
  4. import isys
  5. from translate import _
  6.  
  7. class FormatWindow (InstallWindow):
  8.     def __init__ (self, ics):
  9.     InstallWindow.__init__ (self, ics)
  10.  
  11.         self.todo = ics.getToDo ()
  12.         ics.setTitle (_("Choose partitions to Format"))
  13.         ics.setNextEnabled (1)
  14. ##         ics.setHTML ("<HTML><BODY>Choose partitions to Format</BODY></HTML>")
  15.         ics.readHTML ("format")
  16.  
  17.     def getScreen (self):
  18.         def toggled (widget, (todo, dev)):
  19.             if widget.get_active ():
  20.         todo.fstab.setFormatFilesystem(dev, 1)
  21.             else:
  22.         todo.fstab.setFormatFilesystem(dev, 0)
  23.  
  24.         def check (widget, todo):
  25.             todo.fstab.setBadBlockCheck(widget.get_active ())
  26.  
  27.         box = GtkVBox (FALSE, 10)
  28.  
  29.         mounts = self.todo.fstab.mountList()
  30.  
  31.     gotOne = 0
  32.     for (mount, dev, fstype, format, size) in mounts:
  33.             if fstype == "ext2":
  34.         gotOne = 1
  35.                 checkButton = GtkCheckButton ("/dev/%s   %s" % (dev, mount))
  36.                 checkButton.set_active (format)
  37.                 checkButton.connect ("toggled", toggled, (self.todo, dev))
  38.                 box.pack_start (checkButton)
  39.  
  40.     if not gotOne: return None
  41.  
  42.         vbox = GtkVBox (FALSE, 10)
  43.         vbox.pack_start (box, FALSE, TRUE)
  44.  
  45.         vbox.pack_start (GtkHSeparator (), FALSE, padding=3)
  46.         
  47.         self.check = GtkCheckButton (_("Check for bad blocks while formatting"))
  48.         self.check.set_active (self.todo.fstab.getBadBlockCheck())
  49.         self.check.connect ("toggled", check, self.todo)
  50.         vbox.pack_start (self.check, FALSE)
  51.         
  52.         self.check = GtkCheckButton 
  53.     vbox.set_border_width (5)
  54.         return vbox
  55.